<template>
	<div class="property">
		<hb-title title="资产中心" />
		<div class="box flex">
			<ul class="left">
				<li class="items bb" :class="{active:sel == 1}" @click="e_sel(1,-1)">交易账户</li>
				<li class="items bb" :class="{active:sel == 2}" @click="e_selR(2,0)">静态收益</li>
				<li class="items bb" :class="{active:sel == 3}" @click="e_selR(3,1)">动态收益</li>
			</ul>
			<c-right :personelList="personelList" :rightT="rightT" :rengouInfo="rengouInfo"/>
		</div>
	</div>
</template>

<script>
import Cright from './right'
import {vpost, vlink} from '@api'
export default {
	data() {
		return {
			apiResult: null,
			personelList: [], // 打开资产中心各种币资产的表格
			sel:'1',
			rightT:'-1',
			rengouInfo:{}
		}
	},
	components: {
		'c-right': Cright,
	},
	mounted() {
		this.doStep()
	},
	methods: {
		/**
		 * @Description: ${选择}
		 * @Param
		 * @Return
		 * @Author 焦政
		 * @Date 2018/12/12
		 * @Version 1.0
		 */
		e_sel(s,t){
			this.sel = s
			this.rightT = t
		},
		e_selR(s,t){
			this.sel = s
			this.rightT = t
			this.rengouInfo = t
			// t == 0 ? this.getJT() : this.getDT()
		},

		async doStep() {
			return
			await vpost(vlink.property.own).then(re => {
				if (re.status === '1') {
					this.apiResult = re.data
				}
			})
			this.handleResult()
		},
		handleResult() {
			let d = this.apiResult

			let personelList = []
			let oldBox = d.fvirtualwallets
			for (const key in oldBox) {
				if (oldBox.hasOwnProperty(key)) {
					const value = oldBox[key]
					let newOne = {
						name: value.fvirtualcointype.fname,
						canu: value.ftotal,
						cant: value.ffrozen,
					}
					personelList.push(newOne)
				}
			}
			this.personelList = personelList
		},
	},
}
</script>

<style scoped>
.property {
	margin: 20px auto;
	color: var(--clr0);
}
.left {
	margin-right: 20px;
	width: 15%;
	height: 300px;
	background: var(--bg2);
}
.items {
	margin: 6px;
	height: 40px;
	padding-left: 20px;
	background: var(--bg0);
	line-height: 40px;
	font-size: 14px;
	color: #7a98f7;
	cursor: pointer;
}
	.bb{
		color: white;
	}
	.active{
		color: #7a98f7;
	}
</style>
